package de.carcophan.jimdb.ejb.entites;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


@Entity()
@Table(name = "MOVIESTATUS", uniqueConstraints =
@UniqueConstraint(name = "MOVIESTATUS"))
public class Status implements Serializable {

    @Id()
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long statusId;

    public Status() {
    }

    public Status(String movieStatus) {
        this.movieStatus = movieStatus;
    }

    public Long getStatusId() {
        return statusId;
    }

    public void setStatusId(Long statusId) {
        this.statusId = statusId;
    }
    @Column(name = "MOVIESTATUS")
    private String movieStatus;
    @OneToMany(mappedBy = "movieStatus", fetch = FetchType.LAZY)
    private List<UserMovies> userMovieses;

    public List<UserMovies> getUserMovieses() {
        return userMovieses;
    }

    public void setUserMovieses(List<UserMovies> userMovieses) {
        this.userMovieses = userMovieses;
    }

    public String getMovieStatus() {
        return movieStatus;
    }

    public void setMovieStatus(String movieStatus) {
        this.movieStatus = movieStatus;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Status other = (Status) obj;
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 11 * hash + (this.statusId != null ? this.statusId.hashCode() : 0);
        hash = 11 * hash + (this.movieStatus != null ? this.movieStatus.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Status{" + "movieStatus=" + movieStatus + '}';
    }
}
